﻿using Hangfire.Dashboard;
using System.Diagnostics.CodeAnalysis;

namespace D.UtilHangfire
{
    /// <summary>
    /// 自定义权限验证
    /// </summary>
    public class CustomerHangfireAuthorizationFilter : IDashboardAuthorizationFilter
    {
        public bool Authorize([NotNull] DashboardContext context)
        {
            var httpContext = context.GetHttpContext();

            // 可在此处自定义权限验证。

            // 当前表示所有认证用户都可访问仪表盘
            return httpContext.User.Identity.IsAuthenticated;
        }
    }
}
